<template>
    <page-body>
        <view class="page">
            <view class="flex flex-wrap align-center justify-between benben-position-layout flex centreCoupon_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
                <view class='flex flex-wrap align-center centreCoupon_fd0_0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
                    <text class='fu-iconfont2  centreCoupon_fd0_0_c0'>&#xe794;</text>
                </view>
                <text class='centreCoupon_fd0_1'>领券中心</text>
                <view class='flex flex-wrap align-center centreCoupon_fd0_2'>
                </view>

            </view>
            <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
            <!---flex布局flex布局开始-->
			<fu-loading v-if="isShow"></fu-loading>
            <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout centreCoupon_flex_1" v-else>
                <template v-for='(item,key0) in list'>
                    <view class='flex flex-direction flex-wrap align-stretch' :key='key0'>
                        <view class='flex flex-direction flex-wrap align-stretch centreCoupon_fd1_0_c0' v-if=" item.is_get == '0'">
                            <view class='flex flex-wrap align-center centreCoupon_fd1_0_c0_c0'>
                                <image class='centreCoupon_fd1_0_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"10.png"'></image>
                                <view class='flex flex-direction flex-wrap align-stretch flex-sub centreCoupon_fd1_0_c0_c0_c1'>
                                    <text class='centreCoupon_fd1_0_c0_c0_c1_c0'>{{item.name}}</text>
                                    <text class='centreCoupon_fd1_0_c0_c0_c1_c1' v-if=" item.min_order_money==0 || item.min_order_money==''">无门槛</text>
									<text class='centreCoupon_fd1_0_c0_c0_c1_c1' v-if=" item.min_order_money>0">{{item.subtitle}}</text>
                                </view>
                                <view class='flex flex-wrap align-end'>
                                    <text class='centreCoupon_fd1_0_c0_c0_c2_c0'>￥</text>
                                    <text class='centreCoupon_fd1_0_c0_c0_c2_c1'>{{item.money}}</text>
                                </view>
                            </view>
                            <view class='flex flex-wrap align-center centreCoupon_fd1_0_c0_c1'>
                                <text class='centreCoupon_fd1_0_c0_c1_c0'>有效期至：</text>
                                <text class='centreCoupon_fd1_0_c0_c1_c0'>{{item.end_time}}</text>
                                <button class='centreCoupon_fd1_0_c0_c1_c2' @tap.stop="lingquFunc(item.aid)">立即领取</button>
                            </view>
                        </view>
                        <view class='flex flex-direction flex-wrap align-stretch centreCoupon_fd1_0_c1'  v-if=" item.is_get == '1'">
                            <view class='flex flex-wrap align-center centreCoupon_fd1_0_c0_c0'>
                                <image class='centreCoupon_fd1_0_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"13.png"'></image>
                                <view class='flex flex-direction flex-wrap align-stretch flex-sub centreCoupon_fd1_0_c0_c0_c1'>
                                    <text class='centreCoupon_fd1_0_c0_c0_c1_c0'>{{item.name}}</text>
                                    <text class='centreCoupon_fd1_0_c0_c0_c1_c1'>无门槛</text>
                                </view>
                                <view class='flex flex-wrap align-end'>
                                    <text class='centreCoupon_fd1_0_c1_c0_c2_c0'>￥</text>
                                    <text class='centreCoupon_fd1_0_c1_c0_c2_c1'>{{item.money}}</text>
                                </view>
                            </view>
                            <view class='flex flex-wrap align-center centreCoupon_fd1_0_c0_c1'>
                                <text class='centreCoupon_fd1_0_c1_c1_c0'>有效期至：</text>
                                <text class='centreCoupon_fd1_0_c1_c1_c0'>{{item.end_time}}</text>
                                <button class='centreCoupon_fd1_0_c1_c1_c2'>已领取</button>
                            </view>
                        </view>
                    </view>
                </template>
				<view v-if="list.length == 0" class="text-xl text-center text-gray flex flex-direction align-center justify-center"
					style="margin-top: 20%;">
					<image :src='STATIC_URL+"137.png"' mode="widthFix" style="width:400rpx;"></image>
				</view>
                <!-- <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData" :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty> -->
            </view>
			<view class="flex flex-wrap align-center justify-center benben-position-layout flex centreCoupon_flex_2" v-if="list.length > 0"
				:style="{height:(110+bottomSafeAreaRpx)+'rpx',paddingBottom:bottomSafeAreaRpx+'rpx', }">
				<button class='centreCoupon_fd2_0' @tap.stop="chakan">一键领取</button>
				<!-- <official-account></official-account> -->
			</view>
			<view :style="{height: (110+bottomSafeAreaRpx)+'rpx'}"></view>

            <!---flex布局flex布局结束-->


        </view>
    </page-body>
</template>
<script>
	import fuLoading from "../components/fu-loading/fu-loading.vue"
    import pagingList from '@/common/mixin/paging_list.js';
    import {
        validate
    } from '@/common/utils/validate.js'

    export default {
        components: {fuLoading},
        // mixins: [pagingList],

        data() {
            return {
                "minixPagingListsApi": "",
                "pageingListApiMethod": "",
                "allowOnloadGetList": false,
                "list": {
                    "aid": "",
                    "money": "",
                    "min_order_money": "",
                    "start_time": "",
                    "end_time": "",
                    "status": "",
                    "stock": "",
                    "last_stock": "",
                    "name": "",
                    "receiv_num": "",
                    "use_num": "",
                    "subtitle": ""
                },
                "id": "",
				isShow:false
            };
        },
        computed: {

        },
        watch: {},
        onLoad(options) {
			this.isShow = true
            this.gethx464448a85495Func()
        },
        onUnload() {

        },
        onReady() {

        },
        onShow() {
        },
        onHide() {

        },
        onResize() {

        },
        onPullDownRefresh() {
			this.gethx464448a85495Func()
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
        },
        onReachBottom(e) {

        },
        onPageScroll(e) {

        },
        methods: {
			async chakan(){
				let data66b2db92bc5f9 = await this.$api.dbPost(global.apiUrls.post66b2db92bc5f9);
				if (!data66b2db92bc5f9) return
				if (data66b2db92bc5f9.data.code != 1) {
				    this.$message.info(data66b2db92bc5f9.data.msg);
				    return
				}
				let info64b736f37c250 = data66b2db92bc5f9.data;
				this.$message.info('领取成功！');
				this.isShow = true
				this.gethx464448a85495Func()
				// wx.navigateToMiniProgram({
				//     appId: 'wx8952c91e5901715a',
				//     // path: path,
				//     // extraData: {},
				//     success(res) {
				//         // 打开成功
				//         console.log('跳转成功');
				//     },
				//     fail(err) {
				//         // 打开失败
				//         console.log('跳转失败', err);
				//     }
				// });
			},
            //查询优惠券列表
            async gethx464448a85495Func() {
				let res = await this.$api.get(global.apiUrls.post6674e7fc37a29);
				if (res.data.code != 1) {
				    this.$message.info(res.data.msg);
				    return
				}
				this.list = res.data.data
				this.isShow = false
                // this.minixPagingListsApi = global.apiUrls.post6674e7fc37a29;
                // this.pageingListApiMethod = 'get';
                // this.allowOnloadGetList = false;
                // this.pagingListPostDataContent = {}
                // this.listData = [];
                // this.list = this.listData;
                // this.pagingListToggle();

            },
            //领取优惠劵
            async lingquFunc(id) {
                this.id = id;
                //请求方法
                //数据验证

                let data64b736f37c250 = await this.$api.dbPost(global.apiUrls.post64b736f37c250, {
                    operationcoupon_id: this.id
                });
                if (!data64b736f37c250) return
                if (data64b736f37c250.data.code != 1) {
                    this.$message.info(data64b736f37c250.data.msg);
                    return
                }
                let info64b736f37c250 = data64b736f37c250.data;
				this.$message.info('领取成功！');
				this.isShow = true
                this.gethx464448a85495Func()
            },
            pagingListPostData() {
                // return this.pagingListPostDataContent
            }
        }
    };
</script>
<style lang="scss" scoped>
    .page {
        width: 100vw;
        overflow-x: hidden;
        min-height: calc(100vh - var(--window-bottom));
        background: var(--benbenbgColor3);
        background-size: 100% auto;
    }

    .centreCoupon_flex_0 {
        background: var(--benbenbgColor1);
        width: 750rpx;
        height: 88rpx;
        overflow: hidden;
        z-index: 10;
        top: 0rpx;
        background-size: 100% auto;
    }

    .centreCoupon_fd0_2 {
        width: 120rpx;
        height: 88rpx;
        margin: 0rpx 32rpx 0rpx 0rpx;
    }

    .centreCoupon_fd0_1 {
        color: #333333;
        font-size: 36rpx;
        font-weight: 500;
        line-height: 50rpx;
        text-align: center;
        font-style: normal;
    }

    .centreCoupon_fd0_0_c0 {
        font-size: 36rpx;
        color: #333;
    }

    .centreCoupon_fd0_0 {
        width: 120rpx;
        height: 88rpx;
        margin: 0rpx 0rpx 0rpx 32rpx;
    }

    .centreCoupon_flex_1 {
        padding: 20rpx 32rpx 100rpx 32rpx;
    }

    .centreCoupon_fd1_0_c1_c1_c2 {
        background: var(--benbenbgColor4);
        border-radius: 24rpx 24rpx 24rpx 24rpx;
        font-size: 24rpx;
        color: var(--benbenFontColor3);
        width: 144rpx;
        height: 48rpx;
        line-height: 48rpx;
        margin: 0rpx 0rpx 0rpx auto;
    }

    .centreCoupon_fd1_0_c1_c1_c0 {
        color: var(--benbenFontColor2);
        font-size: 24rpx;
        font-weight: 400;
        line-height: 33rpx;
    }

    .centreCoupon_fd1_0_c1_c0_c2_c1 {
        color: rgba(153, 153, 153, 1);
        font-size: 49rpx;
        font-weight: 600;
        line-height: 70rpx;
        text-align: right;
        font-style: normal;
    }

    .centreCoupon_fd1_0_c1_c0_c2_c0 {
        color: rgba(153, 153, 153, 1);
        font-size: 32rpx;
        font-weight: 600;
        line-height: 62rpx;
    }

    .centreCoupon_fd1_0_c1 {
        background: url(image-path('12.png')) no-repeat;
        background-size: 100% 100% !important;
        padding: 30rpx 32rpx 30rpx 32rpx;
        margin: 0rpx 0rpx 24rpx 0rpx;
    }

    .centreCoupon_fd1_0_c0_c1_c2 {
        background: var(--benbenbgColor0);
        border-radius: 24rpx 24rpx 24rpx 24rpx;
        font-size: 24rpx;
        color: var(--benbenFontColor3);
        width: 144rpx;
        height: 48rpx;
        line-height: 48rpx;
        margin: 0rpx 0rpx 0rpx auto;
    }

    .centreCoupon_fd1_0_c0_c1_c0 {
        color: #333333;
        font-size: 24rpx;
        font-weight: 400;
        line-height: 33rpx;
    }

    .centreCoupon_fd1_0_c0_c1 {
        margin: 20rpx 0rpx 0rpx 0rpx;
    }

    .centreCoupon_fd1_0_c0_c0_c2_c1 {
        color: #DA372C;
        font-size: 49rpx;
        font-weight: 600;
        line-height: 70rpx;
        text-align: right;
        font-style: normal;
    }

    .centreCoupon_fd1_0_c0_c0_c2_c0 {
        color: rgba(218, 55, 44, 1);
        font-size: 32rpx;
        font-weight: 600;
        line-height: 62rpx;
    }

    .centreCoupon_fd1_0_c0_c0_c1_c1 {
        color: #999999;
        font-size: 22rpx;
        font-weight: 400;
        line-height: 30rpx;
        margin: 10rpx 0rpx 0rpx 0rpx;
    }

    .centreCoupon_fd1_0_c0_c0_c1_c0 {
        color: #333333;
        font-size: 32rpx;
        font-weight: 500;
        line-height: 45rpx;
        -webkit-line-clamp: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
    }

    .centreCoupon_fd1_0_c0_c0_c1 {
        margin: 0rpx 0rpx 0rpx 16rpx;
    }

    .centreCoupon_fd1_0_c0_c0_c0 {
        width: 122rpx;
        height: 100rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
    }

    .centreCoupon_fd1_0_c0_c0 {
        border-bottom: 1px dashed rgba(170, 155, 123, 1);
        padding: 0rpx 0rpx 14rpx 0rpx;
    }

    .centreCoupon_fd1_0_c0 {
        background: url(image-path('11.png')) no-repeat;
        background-size: 100% 100% !important;
        padding: 30rpx 32rpx 30rpx 32rpx;
        margin: 0rpx 0rpx 24rpx 0rpx;
    }
	.centreCoupon_flex_2 {
		width: 750rpx;
		height: 110rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
	}
	
	.centreCoupon_fd2_0 {
		background: var(--benbenbgColor7);
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		width: 500rpx;
		line-height: 88rpx;
		font-size: 24rpx;
		color: var(--benbenFontColor3);
	}
</style>